package com.distribute.framework.core.lsf;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.distribute.framework.core.web.helper.SpringBeanHelper;
import com.distribute.framework.core.web.helper.Utils;

/**
 * lsf服务类
 */
@Configuration
public class LsfConfiguration {
	
	@Autowired
    private ApplicationContext applicationContext;
	
	/**
	 * 手动注册LSF
	 * @return
	 */
	@Bean(name="lsf")
    public Lsf getLsf() {
		SpringBeanHelper.initSpring(applicationContext);
		Lsf lsf = new Lsf();
		String lsfFlag = "lsf";
		String lsfRedis = Utils.config("lsf.redis");
		String lsfUrl = Utils.config("lsf.url");
		String lsfTitle = Utils.config("lsf.title");
		lsf.setFlag(lsfFlag);
		lsf.setRedis(lsfRedis);
		lsf.setUrl(lsfUrl);
		lsf.setTitle(lsfTitle);
		return lsf;
    }

}